package com.group.model;

import java.math.BigDecimal;

/**
 * tikcer在交易所的价格
 * 
 * @author zhaolei
 *
 */
public class TickerPrice {

	private Long id;

	/**
	 * 比如BTCUSDT交易对，base asset就是bitcoin
	 */
	private String baseAsset;

	/**
	 * 标记:BTC,ETH等 只用来显示
	 */
	private String baseSymbol;

	/**
	 * 比如BTCUSDT交易对，quote asset就是tether
	 */
	private String quoteAsset;

	/**
	 * 标记,只用来显示,冗余数据
	 */
	private String quoteSymbol;

	/**
	 * 当前价格
	 */
	private Double price;

	/**
	 * 当前价格字符串
	 */
	private String priceStr;

	/**
	 * 交易量
	 */
	private Double volume;

	/**
	 * 涨跌幅
	 */
	private Double changePerc;

	/**
	 * 人民币价格
	 */
	private Double cnyPrice;

	/**
	 * 交易所名称
	 */
	private String exchange;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getBaseAsset() {
		return baseAsset;
	}

	public void setBaseAsset(String baseAsset) {
		this.baseAsset = baseAsset;
	}

	public String getQuoteAsset() {
		return quoteAsset;
	}

	public void setQuoteAsset(String quoteAsset) {
		this.quoteAsset = quoteAsset;
	}

	public Double getPrice() {
		if (price != null)
			return new BigDecimal(price).setScale(10, BigDecimal.ROUND_HALF_UP).doubleValue();
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Double getVolume() {
		return volume;
	}

	public void setVolume(Double volume) {
		this.volume = volume;
	}

	public Double getCnyPrice() {
		return cnyPrice;
	}

	public void setCnyPrice(Double cnyPrice) {
		this.cnyPrice = cnyPrice;
	}

	public String getExchange() {
		return exchange;
	}

	public void setExchange(String exchange) {
		this.exchange = exchange;
	}

	public String getBaseSymbol() {
		return baseSymbol;
	}

	public void setBaseSymbol(String baseSymbol) {
		this.baseSymbol = baseSymbol;
	}

	public String getQuoteSymbol() {
		return quoteSymbol;
	}

	public void setQuoteSymbol(String quoteSymbol) {
		this.quoteSymbol = quoteSymbol;
	}

	public Double getChangePerc() {
		return changePerc;
	}

	public void setChangePerc(Double changePerc) {
		this.changePerc = changePerc;
	}

	public String getPriceStr() {
		if (price != null)
			return new BigDecimal(price).setScale(10, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
		return priceStr;
	}

	public void setPriceStr(String priceStr) {
		this.priceStr = priceStr;
	}

}
